<?php

declare(strict_types=1);
/**
 * This file is part of Hyperf.
 *
 * @link     https://www.hyperf.io
 * @document https://hyperf.wiki
 * @contact  group@hyperf.io
 * @license  https://github.com/hyperf/hyperf/blob/master/LICENSE
 * @author   howe <howe1995@163.com>
 */

namespace App\Crontab;

use App\Command\ApplyOverdueCommand;
use Hyperf\Crontab\Annotation\Crontab;

use function Hyperf\Support\make;

// #[Crontab(rule: '*/10 * * * * *', name: 'ApplyOverdueCrontab', callback: 'handle', memo: '好友申请自动过期', enable: [EnableChecker::class, 'isEnable'])]
class ApplyOverdueCrontab
{
    #[Crontab(rule: '* * * * *', name: 'applyOverdue', memo: '好友申请自动过期', enable: [EnableChecker::class, 'isEnable'])]
    public function applyOverdue()
    {
        var_dump('好友申请自动过期:' . date('Y-m-d H:i:s'));
        $command = make(ApplyOverdueCommand::class);
        $command->handle();
    }

    #[Crontab(rule: '*/10 * * * * *', name: 'demo', memo: 'demo test', enable: [EnableChecker::class, 'isEnable'])]
    public function demo()
    {
        var_dump('demo:' . date('Y-m-d H:i:s'));
    }

    #[Crontab(rule: '*/10 * * * * *', name: 'foo', memo: 'foo test', enable: [EnableChecker::class, 'isEnable'])]
    public function foo()
    {
        var_dump('foo:' . date('Y-m-d H:i:s'));
    }
}
